package LeetcodeTest_forty_three;

//26. 删除排序数组中的重复项
public class removeDuplicates
{
    public static void main(String[] args)
    {
        int[] nums={0,0};
        System.out.println(Solution.removeDuplicates(nums));
    }
}
class Solution
{
    public static int removeDuplicates(int[] nums)
    {
        int i,j,count;
        i=count=0;
        while(i<nums.length-1)
        {
            if(nums[i]==nums[i+1] && nums[i]!=nums[nums.length-1])
            {
                for (j = i + 1; j < nums.length-1; j++)
                {
                    nums[j]=nums[j+1];
                }
            }
            else
                i++;
        }
        for(i=0;i<nums.length-1;i++)
        {
            if(nums[i]!=nums[i+1])
                count++;
        }
        count++;
        for(i=0;i<count;i++)
        {
            System.out.print(nums[i]+"  ");
        }
        return count;
    }
}